load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "isolation",
    srcs = [
        "base.go",
        "optimistic.go",
        "readcommitted.go",
        "repeatable_read.go",
        "serializable.go",
    ],
    importpath = "github.com/pingcap/tidb/sessiontxn/isolation",
    visibility = ["//visibility:public"],
    deps = [
        "//config",
        "//infoschema",
        "//kv",
        "//parser/ast",
        "//parser/mysql",
        "//parser/terror",
        "//planner/core",
        "//sessionctx",
        "//sessionctx/variable",
        "//sessiontxn",
        "//sessiontxn/internal",
        "//sessiontxn/isolation/metrics",
        "//sessiontxn/staleread",
        "//table/temptable",
        "//util/logutil",
        "//util/tracing",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_tikv_client_go_v2//error",
        "@com_github_tikv_client_go_v2//oracle",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "isolation_test",
    timeout = "short",
    srcs = [
        "main_test.go",
        "optimistic_test.go",
        "readcommitted_test.go",
        "repeatable_read_test.go",
        "serializable_test.go",
    ],
    flaky = True,
    shard_count = 29,
    deps = [
        ":isolation",
        "//config",
        "//executor",
        "//expression",
        "//infoschema",
        "//kv",
        "//parser",
        "//parser/ast",
        "//planner",
        "//session",
        "//sessionctx",
        "//sessiontxn",
        "//testkit",
        "//testkit/testfork",
        "//testkit/testsetup",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//error",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//tikv",
        "@org_uber_go_goleak//:goleak",
    ],
)
